package leetcode;

import java.util.Arrays;

public class IsStraight {
    public static void main(String[] args) {
        IsStraight isStraight = new IsStraight();
        System.out.println(isStraight.isStraight(new int[]{0, 1, 2, 3, 4}));
    }

    public boolean isStraight(int[] nums) {
        Arrays.sort(nums);
        int count_zero = 0;
        int min = 14;
        for (int i = 0; i < nums.length - 1; i++) {
            if (nums[i] == 0) {
                count_zero++;
            } else if (nums[i + 1] == nums[i]) {
                return false;
            } else if (nums[i] < min) {
                min = nums[i];
            }
        }
        return nums[4] - nums[count_zero] < 5;
    }
}
